package com.zhan.ielts.domain;

import net.sf.json.JSONObject;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import com.zhan.frame.core.dao.domain.Identifiable;

public class TradeIap implements Identifiable {

	private static final long serialVersionUID = 5177344278368811969L;

	private String id;
	private String userId;
	private String subject;
	private String environment;
	private Integer adam_id;
	private Integer app_item_id;
	private Integer application_version;
	private String bundle_id;
	private Integer download_id;
	private String in_app;
	private String original_application_version;
	private String original_purchase_date;
	private Long original_purchase_date_ms;
	private String original_purchase_date_pst;

	private String receipt_creation_date;
	private Long receipt_creation_date_ms;
	private String receipt_creation_date_pst;
	private String receipt_type;
	private String request_date;
	private Long request_date_ms;
	private String request_date_pst;
	private Integer version_external_identifier;
	private Integer status;
	private Long update_time;

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getSubject() {
		return subject;
	}

	public void setSubject(String subject) {
		this.subject = subject;
	}

	public String getEnvironment() {
		return environment;
	}

	public void setEnvironment(String environment) {
		this.environment = environment;
	}

	public Integer getAdam_id() {
		return adam_id;
	}

	public void setAdam_id(Integer adam_id) {
		this.adam_id = adam_id;
	}

	public Integer getApp_item_id() {
		return app_item_id;
	}

	public void setApp_item_id(Integer app_item_id) {
		this.app_item_id = app_item_id;
	}

	public Integer getApplication_version() {
		return application_version;
	}

	public void setApplication_version(Integer application_version) {
		this.application_version = application_version;
	}

	public String getBundle_id() {
		return bundle_id;
	}

	public void setBundle_id(String bundle_id) {
		this.bundle_id = bundle_id;
	}

	public Integer getDownload_id() {
		return download_id;
	}

	public void setDownload_id(Integer download_id) {
		this.download_id = download_id;
	}

	public String getIn_app() {
		return in_app;
	}

	public void setIn_app(String in_app) {
		this.in_app = in_app;
	}

	public String getOriginal_application_version() {
		return original_application_version;
	}

	public void setOriginal_application_version(String original_application_version) {
		this.original_application_version = original_application_version;
	}

	public String getOriginal_purchase_date() {
		return original_purchase_date;
	}

	public void setOriginal_purchase_date(String original_purchase_date) {
		this.original_purchase_date = original_purchase_date;
	}

	public Long getOriginal_purchase_date_ms() {
		return original_purchase_date_ms;
	}

	public void setOriginal_purchase_date_ms(Long original_purchase_date_ms) {
		this.original_purchase_date_ms = original_purchase_date_ms;
	}

	public String getOriginal_purchase_date_pst() {
		return original_purchase_date_pst;
	}

	public void setOriginal_purchase_date_pst(String original_purchase_date_pst) {
		this.original_purchase_date_pst = original_purchase_date_pst;
	}

	public String getReceipt_creation_date() {
		return receipt_creation_date;
	}

	public void setReceipt_creation_date(String receipt_creation_date) {
		this.receipt_creation_date = receipt_creation_date;
	}

	public Long getReceipt_creation_date_ms() {
		return receipt_creation_date_ms;
	}

	public void setReceipt_creation_date_ms(Long receipt_creation_date_ms) {
		this.receipt_creation_date_ms = receipt_creation_date_ms;
	}

	public String getReceipt_creation_date_pst() {
		return receipt_creation_date_pst;
	}

	public void setReceipt_creation_date_pst(String receipt_creation_date_pst) {
		this.receipt_creation_date_pst = receipt_creation_date_pst;
	}

	public String getReceipt_type() {
		return receipt_type;
	}

	public void setReceipt_type(String receipt_type) {
		this.receipt_type = receipt_type;
	}

	public String getRequest_date() {
		return request_date;
	}

	public void setRequest_date(String request_date) {
		this.request_date = request_date;
	}

	public Long getRequest_date_ms() {
		return request_date_ms;
	}

	public void setRequest_date_ms(Long request_date_ms) {
		this.request_date_ms = request_date_ms;
	}

	public String getRequest_date_pst() {
		return request_date_pst;
	}

	public void setRequest_date_pst(String request_date_pst) {
		this.request_date_pst = request_date_pst;
	}

	public Integer getVersion_external_identifier() {
		return version_external_identifier;
	}

	public void setVersion_external_identifier(Integer version_external_identifier) {
		this.version_external_identifier = version_external_identifier;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public Long getUpdate_time() {
		return update_time;
	}

	public void setUpdate_time(Long update_time) {
		this.update_time = update_time;
	}

	public void setTradeIap(JSONObject jsonObj) {
		adam_id = jsonObj.getInt("adam_id");
		app_item_id = jsonObj.getInt("app_item_id");
		application_version = jsonObj.getInt("application_version");
		bundle_id = jsonObj.getString("bundle_id");
		download_id = jsonObj.getInt("download_id");
		in_app = jsonObj.getJSONArray("in_app").toString();
		original_application_version = jsonObj.getString("original_application_version");
		original_purchase_date = jsonObj.getString("original_purchase_date");
		original_purchase_date_ms = jsonObj.getLong("original_purchase_date_ms");
		original_purchase_date_pst = jsonObj.getString("original_purchase_date_pst");
		receipt_creation_date = jsonObj.getString("receipt_creation_date");
		receipt_creation_date_ms = jsonObj.getLong("receipt_creation_date_ms");
		receipt_creation_date_pst = jsonObj.getString("receipt_creation_date_pst");
		receipt_type = jsonObj.getString("receipt_type");
		request_date = jsonObj.getString("request_date");
		request_date_ms = jsonObj.getLong("request_date_ms");
		request_date_pst = jsonObj.getString("request_date_pst");
		version_external_identifier = jsonObj.getInt("version_external_identifier");
		update_time = System.currentTimeMillis();

	}

	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
	}

	@Override
	public String getId() {
		return this.id;
	}

	@Override
	public void setId(String id) {
		this.id = id;
	}

}
